/*
 * @Author: TJN tjn@246@126.com
 * @Date: 2024-06-24 14:40:53
 * @LastEditors: TJN tjn@246@126.com
 * @LastEditTime: 2024-06-25 16:00:14
 * @FilePath: \hdcms-nest\src\auth\dto\login.dto.ts
 * @Description:
 *
 * Copyright (c) 2024 by ${git_name_email}, All Rights Reserved.
 */
import { IsNotEmpty, Length } from 'class-validator';
import { IsExists } from 'src/validate/is-exists';
import { IsNotExists } from 'src/validate/is-not-exists';
import { validatePassword } from 'src/validate/validatePassword';
export default class LoginDto {
  @IsNotEmpty({ message: '用户名不能为空' })
  @Length(2, 5, { message: '用户名不能小于2个字符,不能大于5个字符' })
  @IsExists('user', ['name', 'email', 'mobile'], { message: '账号不存在' })
  name: string;

  @IsNotEmpty({ message: '密码不能为空' })
  @Length(5, 20, { message: '密码不能小于5个字符,不能大于20个字符' })
  // @validatePassword('user', { message: '密码错误' })
  password: string;
}
